<script>
$(document).ready(function(){
	$("#rand-seed").bt({
        trigger: ['focus', 'blur'],
        positions: ['right']
      });
    // 開始編班
    $("#run-rand").click(function(){
        $("#randRunForm").submit();
    });
});
</script>
<style>
#joinClass span{margin:5px; border:thin dotted #aac; padding:2px;}
td {background:#fff}
</style>
<form action="<?php echo $this->route('rand-run')?>" method="post" id="randRunForm">
<input type="hidden" name="sn" value="<?php echo  $this->data->sn?>" />
<table class="listTable" >
<tr><th colspan=2 >電腦亂數編班填寫表單</th></tr>
<tr>
<td>作業名稱</td>
<td>
<?php $gradeName = unserialize($this->School['length_name']);?>
<?php $arr = explode('-',$this->data->year_semester)?>
<?php echo sprintf($this->translate('%d year %d semester %s'),$arr[0], $arr[1], $gradeName[$arr[2]])?>
<? $semesterClass = new Semester_Model_SemesterClass();
     $arr = explode('-', $this->data->source_year_semester);
     $className = $semesterClass->getClassNames($arr[0], $arr[1], $arr[2]);
 ?>
</td>
</tr>
<tr>
<td>班級數</td>
<td>舊班級數: <u><?php echo  count(explode(",",$this->data->classes))?></u> ,
 新核定班數: <input type="text" name="new_class_num" size="3" value="<?php echo  $this->data->new_class_num?>" />
 </td>
</tr>
<tr>
<td>參加班級</td>
<td id="joinClass">
 <?php foreach (explode(",", $this->data->classes) as $id):?>
 <span><?php echo  $className[$id]?></span>
 <?php endforeach?>
</td>
</tr>

<tr>
<td colspan="2" style="text-align:center">
<input type="button" id="run-rand"  value="開始編班" />
</td>
</tr>

</table>
</form>